<?php
/*
*
* @author ram
*
*/
require_once("config.php");
require_once("urlreader.php");
require_once("linkchecker.php");
require_once("functions.php");
require_once("pageRank.php");

$page = urldecode($_REQUEST['fxid']);

if (empty($page)) {
	echo '';
	die;
}

$u_handle = new urlreader();
$checker = new linkchecker($page);
$GLOBALS['URL_INFO']['BASE'] = $checker->get_base();
$page = $checker->get_full_url($page);

$GLOBALS['URL_INFO']['ROBOTS'] = get_robots($GLOBALS['URL_INFO']['BASE']);
$GLOBALS['URL_INFO']['LINKS'] = array();
$search_page = str_replace($GLOBALS['URL_INFO']['BASE'],'',$page);

//Read Data
list($headers, $htmlCode) = $u_handle->read_data($page, $search_page);

$anchors = get_html_tags($htmlCode, 'a');

$well_links = $checker->get_links($anchors, '', false);

//echo "<pre>";print_r($well_links);

$js = '[';

foreach ($well_links as $s => $def ) {
	if (!empty($def['link']))
			$js .= "'".addslashes(trim($def['link']))."',";
}

$js .= '\'\']';

echo $js;
?>